#include <stdio.h>

int main(void) {
	int s, v;
	int h, m;
	scanf("%d %d", &s, &v);
	if (s % v == 0) {
		if (470 - s / v > 0) {
			h = (470 - s / v) / 60;
			m = (470 - s / v) % 60;
			if (m <= 9) {
				printf("0%d:0%d", h, m);
			} else {
				printf("0%d:%d", h, m);
			}
		} else {
			h = (1910 - s / v) / 60;
			m = (1910 - s / v) % 60;
			if (h <= 9) {
				if (m <= 9) {
					printf("0%d:0%d", h, m);
				} else {
					printf("0%d:%d", h, m);
				}
			} else {
				if (m <= 9) {
					printf("%d:0%d", h, m);
				} else {
					printf("%d:%d", h, m);
				}
			}
		}
	} else {
		if (470 - s / v - 1 > 0) {
			h = (470 - s / v - 1) / 60;
			m = (470 - s / v - 1) % 60;
			if (m <= 9) {
				printf("0%d:0%d", h, m);
			} else {
				printf("0%d:%d", h, m);
			}
		} else {
			h = (1910 - s / v - 1) / 60;
			m = (1910 - s / v - 1) % 60;
			if (h <= 9) {
				if (m <= 9) {
					printf("0%d:0%d", h, m);
				} else {
					printf("0%d:%d", h, m);
				}
			} else {
				if (m <= 9) {
					printf("%d:0%d", h, m);
				} else {
					printf("%d:%d", h, m);
				}
			}
		}
	}
	return 0;
}